package com.gm.census.jackson;

import java.io.IOException;
import java.util.Date;
import java.text.SimpleDateFormat;

import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonProcessingException;
import org.codehaus.jackson.map.JsonSerializer;
import org.codehaus.jackson.map.SerializerProvider;

public class DateSerializer extends JsonSerializer<Date> {

	@Override
	public void serialize(Date value, JsonGenerator json,
			SerializerProvider prov) throws IOException,
			JsonProcessingException {
		if (value != null) {
			SimpleDateFormat df = new SimpleDateFormat("MMM d, yyy HH:kk");
			json.writeString(df.format(value));
		}
	}

}
